package com.ss.android.lockscreen.component;

import android.app.ActivityManager;
import android.content.Context;
import android.text.TextUtils;

import com.ss.android.lockscreen.activity.lock.LockScreenActivity;
import com.ss.android.lockscreen.http.data.ScreenCell.Type;
import com.ss.android.lockscreen.http.data.ScreenCell;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

final class f implements Runnable {
    private final Context a;

    f(Context arg1) {
        this.a = arg1;

    }

    public final void run() {
        String v0_3;
        JSONObject v4;
        String v2;
        try {
            Object v0_1 = this.a.getSystemService(Context.ACTIVITY_SERVICE);
            if (v0_1 == null) {
                return;
            }

            if (!LockScreenActivity.a) {
                com.ss.android.lockscreen.utils.a.a("lockscreen_status", "lockscreen_fail_or_delay");
                return;
            }

            List<ActivityManager.RunningTaskInfo> v0_2 = ((ActivityManager) v0_1).getRunningTasks(1);
            if (v0_2 == null) {
                return;
            }

            if (v0_2.isEmpty()) {
                return;
            }

            v2 = v0_2.get(0).topActivity.getClassName();
            com.ss.android.lockscreen.e.e$b v3 = com.ss.android.lockscreen.bb.a().f;
            if (v3 == null) {

            } else {
                v4 = new JSONObject();
                com.ss.android.lockscreen.bb.a();
                if (!TextUtils.equals(((CharSequence) v2), LockScreenActivity.class.getName()) || !LockScreenActivity.b) {
                    v0_3 = "cover";
                } else {
                    v0_3 = "top";
                }
                try {
                    String v5 = "lock_screen_type";
                    String v1 = android.support.design.a.x(this.a) ? "need_password" : "no_password";
                    v4.put(v5, v1);
                    v4.put("turn_on_type", v0_3);
                    v4.put("top_activity", v2);
                } catch (JSONException v0_4) {
                    v0_4.printStackTrace();
                }
                android.support.design.a.onEvent("lockscreen_on", v4);
            }
            if (ScreenCell.a == null) {
                return;
            }
            if (v3 == null) {
                return;
            }

            JSONObject v1_1 = new JSONObject();
            try {
                v1_1.put("group_id", String.valueOf(ScreenCell.a.f));
                v1_1.put("item_id", String.valueOf(ScreenCell.a.g));
                if (ScreenCell.a.b == Type.LittleVideo) {
                    v1_1.put("group_type", "little_video");
                } else {
                    v2 = "group_type";
                    v0_3 = ScreenCell.a.i ? "video" : "article";
                    v1_1.put(v2, v0_3);
                }
                android.support.design.a.onEvent("lockscreen_show", v1_1);
                return;
            } catch (JSONException v0_4) {
                v0_4.printStackTrace();
            }
        } catch (Exception v0) {
            return;
        }

    }
}

